package springMVC.getParams.controller;

import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author quan
 * @Description 获取Header信息
 * @Date 2023/7/22 18:11
 */


@RestController
@RequestMapping("/web")
public class Demo11_GetHeader {
    @RequestMapping("/get12")
    //获取header信息:同时重命名
//    public String get12(@RequestHeader(value = "User-Agent") String userAgent){
//        return "userAgent"+userAgent;
//    }

    public String get12(@RequestHeader(required = false) String userAgent){
        return "userAgent"+userAgent;
    }
}
